﻿'''
242有效的字母异位词
给定两个字符串 s 和 t ，编写一个函数来判断 t 是否是 s 的 字母异位词。
示例 1:
输入: s = "anagram", t = "nagaram"
输出: true
示例 2:
输入: s = "rat", t = "car"
输出: false
提示:
1 <= s.length, t.length <= 5 * 104
s 和 t 仅包含小写字母
进阶: 如果输入字符串包含 unicode 字符怎么办？你能否调整你的解法来应对这种情况？
思路：
1.排序后是否相等
2.哈希表
'''
#读取输入
s = input()
t = input()
s_dict = {}
t_dict = {}
for c in s:
    if c in s_dict:
        s_dict[c] += 1
    else:
        s_dict[c] = 1
for c in t:
    if c in t_dict:
        t_dict[c] += 1
    else:
        t_dict[c] = 1
if s_dict == t_dict:    #字典可以直接比较是否相等
    print('true')
else:
    print('false')
'''
if len(s_dict) >= len(t_dict):
    for c in s_dict.keys():
        if c not in t_dict:
            print('false')
            exit()
        elif s_dict[c] != t_dict[c]:
            print('false')
            exit()
else:
    for c in t_dict.keys():
        if c not in s_dict:
            print('false')
            exit()
        elif s_dict[c] != t_dict[c]:
            print('false')
            exit()
print('true')
'''


'''
class Solution:
    def isAnagram(self,s:str,t:str)->bool:
        dict_s = {}
        dict_t = {}
        for i in range(len(s)):
            if s[i] not in dict_s:
                dict_s[s[i]] = 1
            else:
                dict_s[s[i]] += 1
        for i in range(len(t)):
            if t[i] not in dict_t:
                dict_t[t[i]] = 1
            else:
                dict_t[t[i]] += 1
        return dict_s == dict_t
#示例
if __name__ == '__main__':
    s = "Abcdef你好"
    t = "bAc你好edf"
    s1 = "anagram"
    t1 = "nagaram"
    s2 = "rat" 
    t2 = "car"
    print(Solution().isAnagram(s,t))
    print(Solution().isAnagram(s1,t1))
    print(Solution().isAnagram(s2,t2))
'''


